package leetcode;

/**
 * Created by Ghost on 2015/1/19 0019.
 */
public class Factorial_Trailing_Zeroes {
    public int trailingZeroes(int n) {
        int count=0;
        while(n>=5){
            n/=5;
            count+=n;
        }
        return count;
    }
    /*public int trailingZeroes(int n){
        int count=0,m=5;
        int k = n/m;
        while(k!=0){
            count+=k;
            m*=5;
            k=n/m;
        }
        return count;
    }*/
    public static void main(String[] args){
        Factorial_Trailing_Zeroes f = new Factorial_Trailing_Zeroes();
        System.out.println(f.trailingZeroes(998));
    }
}
